package com.luanye.enjoy.test;

import com.luanye.enjoy.ServerApplication;
import com.luanye.enjoy.mapper.VillageMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.geo.Point;
import org.springframework.data.redis.core.StringRedisTemplate;

import static com.luanye.enjoy.constants.RedisConst.VILLAGE_GEO_KEY;

@SpringBootTest(classes = ServerApplication.class)
public class InitData {
//
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
//
//    @Autowired
//    private VillageMapper villageMapper;
//
    @Test
    void initVillage(){
        //double x1 = 41.604411;
        //double y1 = 113.132332;
        //Long village_id1 = 2L;
        //stringRedisTemplate.opsForGeo().add(VILLAGE_GEO_KEY, new Point(Double.valueOf(y1), Double.valueOf(x1)), village_id1.toString());
        //
        //double x2 = 40.24341;
        //double y2 = 109.93873;
        //Long village_id2 = 3L;
        //stringRedisTemplate.opsForGeo().add(VILLAGE_GEO_KEY, new Point(Double.valueOf(y2), Double.valueOf(x2)), village_id2.toString());
        //
        //double x3 = 49.483934;
        //double y3 = 117.953424;
        //Long village_id3 = 4L;
        //stringRedisTemplate.opsForGeo().add(VILLAGE_GEO_KEY, new Point(Double.valueOf(y3), Double.valueOf(x3)), village_id3.toString());
        //
        //double x4 = 40.901015;
        //double y4 = 111.903421;
        //Long village_id4 = 5L;
        //stringRedisTemplate.opsForGeo().add(VILLAGE_GEO_KEY, new Point(Double.valueOf(y4), Double.valueOf(x4)), village_id4.toString());
    }
//
//    @Test
//    void testMapper(){
//        villageMapper.getCityS().stream()
//                .forEach(System.out::println);
//    }
}
